sociall.timeds = {
	
	init : function(){
		Event.observe(document, 'click', sociall.timeds.clickHandler);
	},//sociall.timeds.init
	
	clickHandler : function(e){
		if(e.target.className == 'trash'){
			sociall.timeds.deleteFromQueue(e);
		}
	},//sociall.timeds.clickHandler
	
	deleteFromQueue : function(e){
		//delete timeds from the DOM and from the queue
		
		new Ajax.Request(
			sociall.baseUrl + 'timeds/delete/' + e.target.id.replace(/d/, '') + '.json',
			{
				method: 'get',
				onCreate: function(){
				},
				onComplete : function(valasz){
					if(valasz.responseJSON.deleted){
						e.target.parentNode.parentNode.remove();
					}
					else if(valasz.responseJSON.error){
						sociall.notify.box.update(valasz.responseJSON.error);
						sociall.notify.evnt = new Effect.Notify(sociall.notify.container, {notify : {top : 5, left : 300}, fade : {delay : 12}});
					}
					else{
						sociall.notify.box.update('Could not delete - strange error');
						sociall.notify.evnt = new Effect.Notify(sociall.notify.container, {notify : {top : 5, left : 300}, fade : {delay : 12}});
					}
				}
			}
			);

	}//sociall.timeds.deleteFromQueue	
}

document.observe('dom:loaded', function(){
	sociall.timeds.init();
	});